package com.net128.beatportapps;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.log4j.Logger;

public class LoginTest {
	private static Logger log=Logger.getLogger(LoginTest.class);
	private void login(String user, String password) throws Exception {
		String loginUrl="https://www.beatport.com/en-US/html/account/authentication/crm_login";
		loginUrl+="?username="+user+"&password="+password;
		// https://www.beatport.com/en-US/html/account/authentication/crm_login
		// username=beatmeup&password=myjunkie88&Submit=Login&url=en-US&html&account&authentication&crm_login
		HttpClient httpclient = new HttpClient();
		
		GetMethod httpget = new GetMethod(loginUrl);
		try {
			httpclient.executeMethod(httpget);
			log.info(httpget.getStatusLine());
		} finally {
			httpget.releaseConnection();
		}
	}

	public static void main(String[] args) throws Exception {
		if(args.length<2) {
			log.error("Usage: "+LoginTest.class.getName()+" user password");
		} else {
			new LoginTest().login(args[0], args[1]);
		}
	}
}
